var idCurrentlySelected = '';

function tabsOff() {
  for (var i in idTypes) {
    var whichIdType = idTypes[i];
    document.getElementById(whichIdType).style.backgroundColor = '#fff';
  }
}
function getIdHelpString(identifier) {
  for (var i in idTypes) {
    if (idTypes[i] == identifier) {
      return idHelpStrings[i];
    }
  }
  return '';
}
function helpShown() {
  if (document.getElementById('helpArea').style.display == 'block') {
    return 1;
  }
  else {
    return 0;
  }
}
function identifierHelp(identifier) {
  tabsOff();
  if (helpShown()) {
    if (identifier == idCurrentlySelected) { 
      // just close it
      document.getElementById('helpArea').style.display = 'none';
      document.getElementById(identifier).style.cursor = 'help';
    }
    else { 
      // swap the content
      var idPreviouslySelected = idCurrentlySelected;
      document.getElementById(idPreviouslySelected).style.cursor = 'help';
      idCurrentlySelected = identifier;
      document.getElementById('helpArea').innerHTML = getIdHelpString(identifier);
      document.getElementById(identifier).style.backgroundColor = '#ddd';
      document.getElementById(identifier).style.cursor = 'n-resize';           
    }
  }
  else {
    // show help
    idCurrentlySelected = identifier;
    document.getElementById('helpArea').innerHTML = getIdHelpString(identifier);
    document.getElementById('helpArea').style.display = 'block';
    document.getElementById(identifier).style.backgroundColor = '#ddd';
    document.getElementById(identifier).style.cursor = 'n-resize';
  }
}

